<cfimport taglib="../../../assets/" prefix="mm" />

<cfprocessingdirective pageEncoding="utf-8" />
	<cfscript>
	user = event.getValue('user');
	
	roles = event.getValue('Role.list').iterator();
	
	validator = event.getValue('error', structNew() );
	action = event.linkTo( event.getValue('action') );
	</cfscript>
	
	<cfoutput>
	
    <div class="standardForm">	
        <form action="#action#" method="post">
        
			<fieldset>
		        <legend>User</legend>
        				
				<input type="hidden" id="Iduser" name="Iduser" value="#user.getIduser()#" />
				
	            <label for="Name">Name</label>
				<input type="text" id="Name" name="Name" class="formBig" value="#user.getName()#" />
				<cfif structKeyExists( validator, 'Name' ) >
				<span class="formError">#validator['Name'][1]#</span>
				</cfif>
				
				<label for="Email">Email</label>
				<input type="text" id="Email" name="Email" class="formBig" value="#user.getEmail()#" />
				<cfif structKeyExists( validator, 'Email' ) >
				<span class="formError">#validator['Email'][1]#</span>
				</cfif>
							
	            <label for="Username">Username</label>
				<input type="text" id="Username" name="Username" value="#user.getUsername()#" />
				<cfif structKeyExists( validator, 'Username' ) >
				<span class="formError">#validator['Username'][1]#</span>
				</cfif>
							
	            <label for="Password">Password</label>
				<mm:SecurePassword type="text" id="Password" name="Password" value="#user.getPassword()#"/>
				<cfif structKeyExists( validator, 'Password' ) >
				<span class="formError">#validator['Password'][1]#</span>
				</cfif>
							
	            <label for="Shortdescription">Short description</label>
				<cfif structKeyExists( validator, 'Shortdescription' ) >
				<span class="formError">#validator['Shortdescription'][1]#</span>
				</cfif>
				<textarea id="Shortdescription" name="Shortdescription" rows="5" cols="80" style="width: 80%" class="textareasimple">#user.getShortdescription()#</textarea>
							
	            <label for="Description">Description</label>
				<cfif structKeyExists( validator, 'Description' ) >
				<span class="formError">#validator['Description'][1]#</span>
				</cfif>
				<textarea id="Description" name="Description" rows="10" cols="80" style="width: 80%" class="textareasimple">#user.getDescription()#</textarea>
			
		</fieldset>
		
        <br />
		
		<fieldset>
			<legend>User status:</legend>
				
            <label for="Status"><input type="checkbox" id="Status" name="Status" value="1" <cfif user.getStatus()>checked="checked"</cfif> />User active</label>
			
		</fieldset>
		
        <br />
		
		<fieldset>
			<legend>Roles:</legend>
			<select name="idRole">
				<cfloop condition="#roles.hasNext()#">
				<cfset role = roles.next() />
				<option value="#role.getIdRole()#" <cfif user.getIdRole() eq role.getIdRole()>selected="selected"</cfif>>#role.getName()#</option>
				</cfloop>
			</select>
			
		</fieldset>
		
		<br />
		
        <div>
            <input type="submit" value="Submit" class="formButton" />
        </div>
			
		<br />
			
        </form>
    </div>
		
    </cfoutput>
	
